package com.erp.erp_servers.bill_clear.Imp;


import com.erp.erp_dao.BillClearInfo.IBillClearInfoDao;
import com.erp.erp_entitys.BillClearInfo.BillClearInfo;
import com.erp.erp_entitys.BillClearInfo.Cost;
import com.erp.erp_entitys.BillClearInfo.Product;
import com.erp.erp_entitys.bill_declare.InfoSearch;
import com.erp.erp_entitys.bill_declare.carryInfoSearch;
import com.erp.erp_entitys.business.entity.CarryDetailEntity;
import com.erp.erp_servers.bill_clear.BillClearInfoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 结汇主信息表(BillClearInfo)表服务实现类
 *
 * @author makejava
 * @since 2021-01-15 21:13:36
 */
@Service("clearClearInfoService")
public class BillClearInfoServiceImpl implements BillClearInfoService {
    @Resource
    private IBillClearInfoDao clearClearInfoDao;

    /**
     * 通过ID查询单条数据
     *
     * @param clearId 主键
     * @return 实例对象
     */
    @Override
    public BillClearInfo queryById(Integer clearId) {
        return this.clearClearInfoDao.queryById(clearId);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<BillClearInfo> queryAllByLimit(int offset, int limit) {
        return this.clearClearInfoDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param clearClearInfo 实例对象
     * @return 实例对象
     */
    @Override
    public BillClearInfo insert(BillClearInfo clearClearInfo) {
        this.clearClearInfoDao.insert(clearClearInfo);
        return clearClearInfo;
    }

    /**
     * 修改数据
     *
     * @param clearClearInfo 实例对象
     * @return 实例对象
     */
    @Override
    public BillClearInfo update(BillClearInfo clearClearInfo) {
        this.clearClearInfoDao.update(clearClearInfo);
        return this.queryById(clearClearInfo.getClearId());
    }

    /**
     * 通过主键删除数据
     *
     * @param clearId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer clearId) {
        return this.clearClearInfoDao.deleteById(clearId) > 0;
    }

    @Override
    public List<BillClearInfo> selectAllInfobySearch(InfoSearch search) {
        return clearClearInfoDao.selectAllInfobySearch(search);
    }

    @Override
    public List<Cost> selectCostbySearch(InfoSearch search) {
        return clearClearInfoDao.selectCostbySearch(search);
    }

    @Override
    public List<Product> selectProductStaticbySearch(InfoSearch search) {
        return clearClearInfoDao.selectProductStaticbySearch(search);
    }

    @Override
    public List<CarryDetailEntity> queryCarryBySearchClear(carryInfoSearch search) {
        return clearClearInfoDao.queryCarryBySearchClear(search);
    }

    @Override
    public List<BillClearInfo> checkBillNo(String invoicenumber) {
        return clearClearInfoDao.checkBillNo(invoicenumber) ;
    }

}